package com.example.diabeco;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.widget.Toast;



public class RadioButtonDialogFragment extends DialogFragment {
    
	//Obtenemos la actividad que llamo al "Fragment"
	Activity activity = getActivity();
	
	/* Constructor para cuando pueda instanciar un solo fragment para todos los radio buttons
    public static MyAlertDialogFragment newInstance(int title) {
        MyAlertDialogFragment frag = new MyAlertDialogFragment();
        Bundle args = new Bundle();
        args.putInt("title", title);
        frag.setArguments(args);
        return frag;
    }
    */
    public interface NoticeDialogListener {
//        public void onDialogPositiveClick(DialogFragment dialog);
//        public void onDialogNegativeClick(DialogFragment dialog);
    }
    
	@Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        
		// Use the Builder class for convenient dialog construction
        AlertDialog.Builder popup = new AlertDialog.Builder(activity);
	
        //Titulo
        popup.setMessage(R.string.txt_peso_um);
        
        //Lista de valores
        popup.setSingleChoiceItems(R.array.lb_um_peso, 1, new DialogInterface.OnClickListener() {
           
        	public void onClick(DialogInterface dialog, int which) {
            // El argumento 'which' contiene el indice del elemento seleccionado
            // Acciones a realizar al grabar
    			CharSequence v_texto = "Grabar el Valor seleccionado: ";
    			Toast toast = Toast.makeText(activity, v_texto, Toast.LENGTH_SHORT);
    			toast.show();	
           }
        });
        		//Boton Aceptar
//               builder.setPositiveButton(R.string.fire, new DialogInterface.OnClickListener() {
//                   public void onClick(DialogInterface dialog, int id) {
//                       // FIRE ZE MISSILES!
//                   }
//               })

        //Boton Cancelar
        popup.setNegativeButton(R.string.txt_cancelar, new DialogInterface.OnClickListener() {
                   public void onClick(DialogInterface dialog, int id) {
                       // User cancelled the dialog
                   }
               });
        
        // Create the AlertDialog object and return it
        return popup.create();
    }
}
